home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
basic
/
bc7tb523.zip
/
MIXED.DOC
< prev
next >
Wrap
Text File
|
1992-05-12
|
32KB
|
779 lines
MIXED-LANGUAGE TOOLBOX FOR QuickBASIC
─────────────────────────────────────
By Christy Gemmell
These are native QuickBASIC functions and procedures which call the
machine-code routines in the Assembly-Language Toolbox for QuickBASIC.
To use them, you must link both TOOLBOX.LIB, from the Assembly-Language
Library disk, and the copy of MIXED.LIB from the Mixed-Language Library
disk to your stand-alone programs, like this:
LINK yourprog,,,toolbox.lib mixed.lib;
Since the QuickBASIC environment only allows one Quick Library to be
loaded at a time, however, the version of MIXED.QLB supplied also
contains all the routines from TOOLBOX.LIB. This allows you to use the
environment to develop and test programs which use functions from
both libraries. Just start QuickBASIC with the command:
QB(X) yourprog /L mixed.qlb
You can even build your own Quick Libraries, incorporating Toolbox
routines, using the QuickBASIC Linker as follows:
LINK /QU yoursub.obj yourfun.obj toolbox.lib mixed.lib,,bqlb45.lib;
BQLB45.LIB is the special interface library supplied with Microsoft's
QuickBASIC 4.5 compiler. Substitute the following library names for other
versions of the language.
BQLB40.LIB for QuickBASIC 4.0
BQLB41.LIB for BASIC 6.0
QBXQLB.LIB for BASIC 7.0 and 7.1 PDS
Be sure that, whichever interface library you use, it can be found by
LINK.EXE when the library is being built. This can be done, either by
copying it to the Linker's own directory or to a subdirectory pointed to
by a LIB= environment variable in your AUTOEXEC.BAT file, for example:
SET LIB=C:\QB45\LIBRARY
See your MS-DOS or PC-DOS manual for more information about environment
variables.
If you have the Professional version of the Assembly-Language Toolbox,
of course, building customised libraries is much easier since a full
set of object (.OBJ) modules, together with source code, is supplied
with this release.
The stand-alone (.LIB) and Quick Library (.QLB) versions of the Mixed-
Language Toolbox both contain the following SUB programs and FUNCTION
procedures:
BARMENU
Creates and operates a menu orientated horizontally on the screen row
specified. The calling program must supply :
Row% = The screen row on which the menu bar will appear.
Atr% = The display attribute or colour for the menu bar.
Opt% = Number of options available for selection.
Menu$() = String array containing selection list. Menu$(0) should
be set to a string of ASCII characters, corresponding to
the initial or key letter of each option in the list.
Insert a space at the appropriate position of an option
to be disabled. In the remaining option strings an
ampersand '&' indicates that the next character is the
Hotkey to be highlighted for that option.
Bar% = The menu selection to be highlighted on entry into the
procedure.
Nxt% = If set, this flag just causes the menu to be refreshed
without pausing for a selection from the user. This is
used to handle presses on the Right or Left Arrow keys
in the Pull-Down Menu procedure.
Ctx% = If set, this flag indicates that context-sensitive help
is available, in which case ...
Tpc$ = The root name of the Topic file to be displayed if the
user presses <F1> for help. The current selection number
is appended to this to produce the actual filename.
eg, if Tpc$ = "CONFIG" and Bar% = 3
HelpMate (see TOOLBOX.DOC) will look for a Topic file
named CONFIG3.HLP.
Mouse% = If set, this flag indicates that a mouse is installed
and can be used to make selections.
HotKeys% = If set, this flag allows hotkeys to go directly to a
selection without you having to press <ENTER> as well.
DECLARE SUB BarMenu (Row%, Atr%, Opt%, Menu$(), Bar%, Nxt%, Ctx%,_
Topic$, Mouse%, HotKeys%)
On completion the procedure returns with the following variable set:
Bar% = Number of selection made by user. If zero then the
<Escape> key was pressed to abort the procedure
without making a selection.
VERMENU (see below) is a similar procedure which operates a vertically
orientated point-and-shoot type menu.
See the source code of DEMON.BAS, the Toolbox demonstration program, for
examples of BARMENU and VERMENU in use.
BINDEC
Translates a string of binary digits to their long integer decimal
equivalent.
DECLARE FUNCTION BinDec& (Binary$)
CAPITAL
Converts all alphabetic characters in a string to lower-case,
except for the first character of each word, which is forced
to upper-case.
DECLARE FUNCTION CapItal$ (Original$)
This function is designed for use in printing address labels
and can correctly identify and format proper surnames like
'McLaughlin'.
CENTRE
Centres the string supplied within an empty string of specified width.
DECLARE FUNCTION Centre$ (Text$, MaxWidth%)
This function is called by the VERMENU routine (see below) to centre the
title of a pull-down menu within the window it refers to.
CHECKPRINTER
This procedure checks if the specified parallel printer is ready and
on-line. If so, it returns immediately with Ready% set to -1 (TRUE), if
not, CHECKPRINTER displays the message 'PRINTER NOT READY' on the bottom
row of the screen and waits for the operator to correct the problem and
press a key.
If the user presses <Escape>, the procedure returns with Ready% set to
zero (FALSE). Any other keystroke causes it to go back and test the
printer again. CHECKPRINTER will not return until either the printer is
ready for output, or the <Escape> key is pressed.
DECLARE SUB CheckPrinter (Printer%, Ready%)
Printer% is the number of the parallel printer to test (1 = LPT1: etc).
Example: CheckPrinter 1, Ready% ' Test LPT1:
IF NOT Ready% THEN
STOP
ELSE
LPRINT Stuff$
END IF
DATEINPUT
Accepts and verifies date input in a Reverse Video entry panel, all the
usual editing keys are supported and entry is terminated by either a
Carriage Return or one of several special function keys (see below).
DECLARE FUNCTION DateInput$ (Default$, Context%, Topic$, HotKey%)
Default$ = default string which can be accepted by just pressing
the <Enter> key.
Context% = set TRUE if context-sensitive help is available, in
which case ...
Topic$ = name of the HELP Topic file to display whenever the
<F1> key is pressed.
HotKey% = If entry is terminated by anything other than the
<Enter> key, this variable will contain an explanatory
return code ..
Return Codes: 1 = <Escape> abort entry returning a null string
2 = <F2> repeat previous entry for this field
3 = <Up Arr> pressed, move to previous field
4 = <Dn Arr> pressed, move to next field
5 = <Pg Up> pressed, move to top of screen
6 = <Pg Dn> pressed, move to end of screen
Editing Keys: <L.Arrow> = Move cursor one character to the left
<R.Arrow> = Move cursor one character to the right
<Home> = Move cursor to first character of field
<End> = Move cursor to last character of field
<Ctrl End> = Clear from current cursor position to
the end of the entry field.
<BackSpace> = Replace character under cursor with a
blank space and move cursor one character
to the left.